#include "stdlib.hpp"

#include <purewell/purewell.hpp>
#include <purewell/buffer.hpp>
#include "buffersimple.hpp"
#include "bufferdeque.hpp"

namespace purewell
{

PWBuffer::PWBuffer()
{
}

PWBuffer::~PWBuffer()
{
}

PWBuffer*
PWBuffer::create(int type)
{
	switch(type)
	{
	case PWBUF_DEQUE: return new PWBufferDeque;
	case PWBUF_SIMPLE: return new PWBufferSimple;
	case PWBUF_DEFAULT: return new PWBufferDeque;
	};

	return NULL;
}

void
PWBuffer::release(PWBuffer* obj)
{
	delete obj;
}

PWBuffer&
PWBuffer::operator << (const char* str)
{
	const size_t slen(strlen(str));
	write(str, slen);
	return *this;
}

};//namespace purewell

